<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>签约网</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>
    <style>
        .details img{width: 100%}
    </style>
</head>
<body>
<div id="secHeader">
  <header class="header">
      <a href="javascript:void(0);" onclick="api.closeWin()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
      <h2>资讯详情</h2>
      <a href="javascript:void (0);" class="share_btn"><img src="../image/share_icon.png" alt=""></a>
  </header>
</div>

<section class="news_detail">
    <div class="details_img">
        <div id='pv' style="width:100%"></div>

        <h6 class="details_title" id='name'>借条被担保人撕毁，债务还能要回来吗？担保人需要承担什么责任？</h6>
        <div class="detail_time">
            <em id='time'>2019-05-03 08:10:56</em>
            <span id='view'>1103</span>
        </div>
    </div>
    <div class="details" id='content'>
        <p>　　钱借给别人，但借条被担保人撕了，这钱还能要回来吗？</p>
    </div>
</section>

<section class="comment_section">
    <div class="news_title">
        <h2>评论区</h2>
    </div>
    <div class="comment_list">
        <ul id='con'>

            <!-- <li>
                <div class="userInfo">
                    <img src="../image/userimg2.jpg" alt="">
                    <div class="userName">
                        <h6>175****7415</h6>
                        <span>2019-11-11  14:45</span>
                    </div>
                </div>
                <div class="comment_info">
                    <p>钱借给别人，但借条被担保人撕了，这钱还能要回来吗？近日法院审理了这样一起民事纠纷案件。</p>
                </div>
            </li> -->
        </ul>
    </div>
</section>

<section class="fixed_comment">
    <ul>
        <li><span class="collect_btn"></span></li>
        <li><input id="comment_info" type="text" placeholder="我来说两句"></li>
        <li><button class="comment_submit" type="button">发送</button></li>
    </ul>
</section>
<div class="fixed_share">
    <div class="fixed_content">
        <div class="fixed_title">
            <h6>分享</h6>
        </div>
        <div class="fixed_article">
            <div class="share">
                <ul>

                    <li class="wx"><a onclick="share_wx('session')"><img src="../image/share1.png" alt=""><p>微信好友</p></a></li>
                    <li class="wx"><a onclick="share_wx('timeline')"><img src="../image/share2.png" alt=""><p>朋友圈</p></a></li>
                    <li class="qq"><a onclick="openqqzoom('QFriend')"><img src="../image/share3.png" alt=""><p>QQ好友</p></a></li>
                    <li class="qq"><a onclick="openqqzoom('QZone')"><img src="../image/share4.png" alt=""><p>QQ空间</p></a></li>
                    <li class="wb"><a onclick="openwb()" ><img src="../image/share5.png" alt=""><p>新浪微博</p></a></li>
                    <li><a onclick="copy()"><img src="../image/share6.png" alt=""><p>复制链接</p></a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    var para
    var plnum
    var icon
    var thumb

    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });

        para=api.pageParam;


        var p={model:'news',id:para.id,path:1};
        api.ajax({
            url: webSiteUrl+'/app/home/find',
            method: 'post',
            data: {
                values:p
            }
        }, function(ret, err) {
            api.hideProgress();
            //alert(JSON.stringify(ret))
            if(ret.code==200){
                if(ret.data.fileid>0){
                    var video='<video style="height:3.2rem; width:100%;" src="'+webSiteUrl+ret.data.file+'"  poster="'+webSiteUrl+ret.data.icon+'" controls="controls"></video>';
                    $('#pv').html(video);
                }else{
                    icon=ret.data.icon
                    $('#pv').html('<img src="'+webSiteUrl+ret.data.icon+'">');
                }


                $('#name').html(ret.data.name);
                $('#content').html(ret.data.content);
                $('#time').html(ret.data.time);
                $('#view').html(ret.data.view);

                //is_col()
                pl()
            }else{alert(ret.msg)}
        });

        // ios 登录检测是否安装第三方app
         check_qq();
         check_wx();
         check_wb();

    }


        //分享到微信
        function share_wx(wx_scene){//wx_scene,取值范围：session（会话）timeline（朋友圈）favorite（收藏）

            var wx = api.require('wx');
            wx.isInstalled(function(ret, err){
                if(ret.installed){
                    //alert("当前设备已安装微信客户端");
                    wx.shareWebpage({
                        scene: wx_scene,
                        title: '签约网',
                        description: '签约网下载',
                        thumb: 'widget://login.jpg',
                        contentUrl: webSiteUrl+'/home/Article/Download'
                    }, function(ret, err){

                    });


            }else{
                alert('当前设备未安装微信客户端，请安装微信后再分享。');
            }
        });
    }

        //分享到QQ
     function openqqzoom(type) {

        var qq = api.require('qq');
        qq.installed(function(ret, err) {
                if (ret.status) {
                    qq.shareNews({
                        url : webSiteUrl+'/home/Article/Download',
                        title : '签约网',
                        description : '签约网下载',
                        imgUrl : 'widget://login.jpg',
                        type:type        //  QFriend
                    }, function(ret, err) {
                        if (ret.status) {

                        }

                    });
                } else {
                    api.toast({
                        msg : '当前设备未安装QQ客户端'
                    });

                }
        });
    }


    //分享微博
    function openwb(){
        var id = api.pageParam.id;
        var weibo = api.require('weibo');
        weibo.isInstalled(function(ret) {
            if (ret.status) {
                weibo.shareWebPage({
                    title: '签约网',
                    description: '签约网下载',
                    thumb: 'widget://login.jpg',
                    contentUrl: webSiteUrl+'/home/Article/Download'
                }, function(ret, err) {
                    if (ret.status) {

                    }
                });
            } else {
                alert('未安装新浪微博客户端');
            }
        });
    }

    //复制
     function copy(){
        var clipBoard = api.require('clipBoard');
        clipBoard.set({
            value: webSiteUrl+'/home/lawyer/login'
        }, function(ret, err) {
            if (ret) {

            }
        });
    }


    function pl(){
        var p={type:1,id:para.id}
        api.ajax({
            url: webSiteUrl+'/app/public/pl',
            method: 'post',
            data: {
                values:p
            }
        }, function(ret, err) {
            api.hideProgress();

            if(ret.code==200){

                var html="";
                var tj=ret.data.com;

                if(tj.length>0){
                    plnum=tj.length;
for(var i=0;i<tj.length;i++){
                        if(ck(tj[i].icon)){
                            var u=''
                        }else{
                            var u=webSiteUrl
                        }
html+='<li><div class="userInfo"><img src="'+u+tj[i].icon+'" alt=""><div class="userName"><h6>'+tj[i].phone+'</h6><span>'+tj[i].time+'</span></div></div><div class="comment_info"><p>'+tj[i].content+'</p></div></li>';
}
                    $(".comment_list ul").html(html);
                }else{
                    plnum=0;
                    $('#con').html('<p style="text-align:center">暂无评论</p>');
                }


                //$('#icon').attr("src",webSiteUrl+ret.data.icon);
                $('#name').html(ret.data.name);
                $('#content').html(ret.data.content);
                $('#time').html(ret.data.time);
                $('#view').html(ret.data.view);


            }else{alert(ret.msg)}


        });


    }


    $(".share_btn").click(function () {
        $(".fixed_share").fadeIn().find(".fixed_content").animate({
            'top':'0',
            'opacity':'1'
        },400)
    });
    $(".fixed_content").click(function (e) {
        e.stopPropagation();
    });
    $(".share ul li").click(function () {
        $(".fixed_share").fadeOut().find(".fixed_content").animate({
            'top':'4rem',
            'opacity':'0'
        },400)
    });
    //关闭分享
    $(".fixed_share").click(function (e) {
        e.stopPropagation();
        $(".fixed_share").fadeOut().find(".fixed_content").animate({
            'top':'4rem',
            'opacity':'0'
        },400)
    });

    //收藏
    $('.collect_btn').click(function () {
        if(!loginCheck()){
            return false;
        }
        if($(this).hasClass('active')){
            var p={token:token,type:1,id:para.id,infock:2}
            api.ajax({
                url: webSiteUrl+'/app/user/del_collection',
                method: 'post',
                data: {
                    values:p
                }
            }, function(ret, err) {
                if(ret.code==200){
                    $('.collect_btn').removeClass('active');

                }
            });

        }else {
            var p={token:token,type:1,id:para.id,infock:2}
            api.ajax({
                url: webSiteUrl+'/app/user/add_collection',
                method: 'post',
                data: {
                    values:p
                }
            }, function(ret, err) {
                if(ret.code==200){
                    $('.collect_btn').addClass('active');

                }
            });

        }
    });
    //fa评论
    $('.comment_submit').click(function () {
        if(!loginCheck()){
          return false;
        }
        var val = $("#comment_info").val();
        if(val!=''){
            var p={token:token,type:1,id:para.id,content:val}
            api.ajax({
                url: webSiteUrl+'/app/user/addpl',
                method: 'post',
                data: {
                    values:p
                }
            }, function(ret, err) {
                api.hideProgress();

                if(ret.code==200){
                    //alert(JSON.stringify(ret))
                    var tj=ret.data
var html='<li><div class="userInfo"><img src="'+webSiteUrl+tj.icon+'" alt=""><div class="userName"><h6>'+tj.phone+'</h6><span>'+tj.time+'</span></div></div><div class="comment_info"><p>'+tj.content+'</p></div></li>';
                if($(".comment_list ul li").length>0){
                    $(".comment_list ul").prepend(html);
                }else{
                    $(".comment_list ul").html(html);
                }

                $("#comment_info").val('')

                }else{alert(ret.msg)}
            });



        }else {
            alert('请输入评论内容')
        }
    })

</script>
</html>
